<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" th:href="@{/css/font.css}">
    <link rel="stylesheet" th:href="@{/css/xadmin.css}">
    <link rel="stylesheet"  th:href="@{/css/file.css}" />
    <link rel="stylesheet"  th:href="@{/css/bootstrap.css}" />
    <link th:href="@{/css/semantic.min.css}" rel="stylesheet">
    <script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/js/xadmin.js}"></script>
    <script th:src="@{/js/jquery.js}"></script>
    <script th:src="@{/js/bootstrap.js}"></script>
    <script type="text/javascript" th:src="@{/js/bootstrap-paginator.js}"></script>
    <script th:src="@{/js/semantic.min.js}"></script>

    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>

<!--    弹出框删除-->
<div class="ui basic modal" id="deletemodal">
    <h2 class="header">
        删除课程
    </h2>
    <div class="content">
        删除课程
    </div>
    <form  method="post" th:action="@{/stu/file/delete}">
        <input type="hidden" id="getid" name="id">
        <div class="actions">
            <button class="ui negative button" type="button">否</button>
            <button class="ui positive button" type="submit">是</button>
        </div>
    </form>
</div>
<!--    弹出框删除-->

<!--管理界面-->
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">
                    <a class="layui-btn" href="" ><i class="layui-icon layui-icon-refresh-3"></i> 刷新</a>
                </div>
                <!--                列表-->
                <div class="layui-card-body ">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th>资料名</th>
                            <th>点击量</th>
                            <th>发布时间</th>
                            <th>操作</th>
                            <th>操作</th>
                        </thead>
                        <tbody>
                        <tr th:each="file:${files}">
                            <td th:text="${file.getName()}"></td>
                            <td th:text="${file.getClick()}"></td>
                            <td th:text="${#dates.format(file.getCreatetime(),'yyyy年MM月dd日')}"></td>
                            <td>
                                <a th:href="'https://wk2020.oss-cn-shenzhen.aliyuncs.com/'+${file.getPath()}" target="_blank">资料预览</a>
                            </td>
                            <td>
                                <button class="ui  button" th:onclick="|deleteid(${file.getId()})|">删除</button>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <!--使用bootstrop-paginot实现分页-->
                    <!--                    <ul id="pagination"></ul>-->
                </div>
                <!--                列表-->
            </div>
        </div>
    </div>
</div>
<!--管理界面-->

</body>
<script>
    //添加跳转
    $(document).ready(function () {
        $('#buttonadd').click(function () {
            layer.open({
                type: 2,
                title: '资料添加',
                maxmin: true,
                shadeClose: true, //点击遮罩关闭层
                area : ['800px' , '520px'],
                content:  '/stu/course/pdf/add'
            });
        })
    });
    //添加跳转


    //进行删除操作
    function deleteid(id) {
        console.log(id);
        $('#getid').val(id);
        $('#deletemodal')
            .modal({
                blurring:true,
                onApprove:function () {
                    console.log('确认')
                },
                onDeny:function () {
                    console.log('拒绝')
                }
            })
            .modal('show');
    }
</script>
</html>